﻿using Microsoft.Extensions.DependencyInjection;

namespace System
{
    [AttributeUsage(AttributeTargets.Class)]
    public class InjectionAttribute : Attribute
    {
        public Type? ServiceType { get;  }
        public ServiceLifetime Lifetime { get;} = ServiceLifetime.Transient;

        public InjectionAttribute(Type? serviceType, ServiceLifetime lifetime)
        {
            ServiceType = serviceType;
            Lifetime = lifetime;
        }

        public InjectionAttribute()
            :this(null, ServiceLifetime.Transient)
        {
           
        }

        public InjectionAttribute(Type serviceType)
           : this(serviceType, ServiceLifetime.Transient)
        {

        }
    }
}
